<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .shopbox {
            width: 100%;
            height: 667px;
            background-color: rgba(0, 0, 0, 0.5);
        }

        .shopcar {
            width: 100%;
            box-sizing: border-box;
            position: fixed;
            bottom: 0;
            padding: 15px;
            background-color: white;
        }

        .title {
            display: flex;
            font-weight: bolder;
            justify-content: space-between;
        }

        .list {
            display: flex;
            margin-bottom: 20px;
        }

        .list img {
            width: 80px;
            height: 80px;
        }

        .list .text {
            display: flex;
            margin-left: 15px;
            flex-direction: column;
            justify-content: space-between;
        }

        .list .text h5 {
            font-weight: bolder;
        }

        .list .price {
            display: flex;
            justify-content: space-between;
        }

        .list .btn {
            position: fixed;
            right: 15px;
        }

        .list .price span:first-child {
            color: red;
        }

        .list button {
            width: 20px;
            height: 20px;
            border: none;
            color: white;
            background-color: rgb(24, 165, 220);
            border-radius: 50%;
        }

        .total {
            width: 100%;
            height: 60px;
            color: rgb(222, 222, 222);
            position: fixed;
            align-items: center;
            bottom: 0;
            left: 0;
            padding: 10px;
            font-size: 18px;
            box-sizing: border-box;
            background-color: rgb(54, 54, 54);
            display: flex;
            justify-content: space-around;
        }

        .total button {
            width: 100px;
            height: 40px;
            color: white;
            font-size: 18px;
            border-radius: 5px;
            background-color: rgb(9, 163, 27);
        }

        .banner-list {
            margin-bottom: 60px;
        }

        .empty {
            width: 100%;
            height: 100px;
            line-height: 100px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="shopbox">
            <div></div>
            <div class="shopcar">
                <div class="title">
                    <h4>已选商品</h4>
                    <div @click="clear">清空</div>

                </div>
                <div class="empty" v-show="this.listArr==0">购物车空空如也，快去选购商品吧！</div>
                <div class="banner-list">
                    <div class="list" v-for="(item,index) in listArr">
                        <img :src="item.pic" alt="">
                        <div class="text">
                            <h5>{{item.name}}</h5>
                            <div class="price">
                                <span>￥{{item.price}}</span>
                                <div class="btn">
                                    <button @click="reduce(item)">-</button>
                                    <span>{{item.num}}</span>
                                    <button @click="add(item)">+</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="total">
                    <div>
                        总价:<span>￥{{totalPrice}}</span>
                        数量:<span>{{totalNum}}</span>
                    </div>
                    <button>去结算</button>
                </div>
            </div>
        </div>
    </div>
    <script src="1.vue-2.5.21.js"></script>
    <script src="5.效果4-购物车.js"></script>
</body>

</html>